DROP TABLE IF EXISTS jms_dm.dm_sqs_project_customer_waybill_detail_dt;
CREATE TABLE jms_dm.dm_sqs_project_customer_waybill_detail_dt
(
    waybill_id               varchar(100) comment '运单号',
    customer_code            varchar(100) comment '客户编码',
    project_first_type_code  varchar(100) comment '项目一级',
    project_first_type_name  varchar(100) comment '项目一级',
    project_second_type_name varchar(100) comment '项目二级',
    customer_name            varchar(100) comment '客户名称',
    date_time                date comment '日期',
    complaint_flag           int comment '1代表客诉标识',
    sham_flag                int comment '1代表虚假标识',
    delay_flag               int comment '1代表延误标识',
    worn_flag                int comment '1代表破损标识'
) ENGINE = OLAP DUPLICATE KEY(waybill_id,customer_code,project_first_type_code)
COMMENT '平台项目指标达成报表'
PARTITION BY RANGE(date_time)
(START ('2023-11-01') END ('2023-12-25') EVERY (INTERVAL 1 day) )
DISTRIBUTED BY HASH(waybill_id) BUCKETS 1
PROPERTIES (
'replication_num' = '3',
'dynamic_partition.enable' = 'true',
'dynamic_partition.time_unit' = 'DAY',
'dynamic_partition.time_zone' = 'Asia/Shanghai',
'dynamic_partition.start' = '-180',
'dynamic_partition.end' = '3',
'dynamic_partition.prefix' = 'p',
'dynamic_partition.buckets' = '1',
'in_memory' = 'false',
'storage_format' = 'V2'
);